package com.xuecheng.content.feignclient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author Tang
 * @version 1.0
 * @date 2024/1/10 15:37
 */
@Slf4j
@Component
public class SearchServiceFactory implements FallbackFactory<SearchServiceFeignClient> {
    @Override
    public SearchServiceFeignClient create(Throwable throwable) {
        return courseIndex -> {
            log.error("SearchServiceFeignClient 远程调用熔断, {}", throwable.getLocalizedMessage());
            return false;
        };
    }
}
